package Vistas;
import java.awt.BorderLayout;
import java.awt.Image;
import java.net.URL;
import java.util.ArrayList;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.JTextField;
import javax.swing.SpinnerListModel;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;

//import Controlador.CAcceso;
import Controlador.CUmpire;
import Modelo.Umpire;


public class VUmpire extends javax.swing.JFrame {
	private JLabel lblImagenArbitro;

	/**
	* Auto-generated main method to display this JFrame
	
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				VUmpire inst = new VUmpire();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}*/
	
	//String path = System.getProperty("user.dir")+"src\\Imagenes\\corderologo.png";  
	//URL url = this.getClass().getResource(path);  
	
	private JButton btnSalir;
	private JButton btnLimpiar;
	private JButton btnRegistrar;
	ImageIcon icon = new ImageIcon("src\\Imagenes\\bannerArbitros.png");
	public JSpinner cmbmes;
	private JLabel lbldia;
	private JLabel lblmes;
	private JLabel lblano;
	public JSpinner cmbdia;
	public JSpinner cmbano;
	private JPanel pnlfecha;
	private JLabel lblfecha_nacimiento;
	
	Image img = icon.getImage();
    Image newimg = img.getScaledInstance(626, 250,  java.awt.Image.SCALE_SMOOTH);
	ImageIcon newIcon = new ImageIcon(newimg);
	
	private JPanel pnlBotones;
	private JLabel lvbDatos;
	private JTextField txtNombre;

	private JTextField txtCedula;
	private JTextField txtApellido;
	private JLabel lblCedula;
	private JLabel lblApellido;
	private JLabel lblNombre;
	
	public JTextField getTxtNombre() {
		return txtNombre;
	}

	public void setTxtNombre(JTextField txtNombre) {
		this.txtNombre = txtNombre;
	}

	public JTextField getTxtCedula() {
		return txtCedula;
	}

	public void setTxtCedula(JTextField txtCedula) {
		this.txtCedula = txtCedula;
	}

	public JTextField getTxtApellido() {
		return txtApellido;
	}

	public void setTxtApellido(JTextField txtApellido) {
		this.txtApellido = txtApellido;
	}


	public VUmpire() {
		super();
		
		initGUI();
		CUmpire controlador = new CUmpire (this);
		txtNombre.addActionListener(controlador);
		txtApellido.addActionListener(controlador);
		txtCedula.addActionListener(controlador);
		btnLimpiar.addActionListener(controlador);
		btnSalir.addActionListener(controlador);
		btnRegistrar.addActionListener(controlador);
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setBackground(new java.awt.Color(0,128,192));
			getContentPane().setLayout(null);
			this.setResizable(false);
			this.setTitle("Arbitros");
			//this.setIconImage(new ImageIcon(getClass().getClassLoader().getResource("Imagenes/logoArbitro.PNG")).getImage());
			{
				lblImagenArbitro = new JLabel();
				getContentPane().add(lblImagenArbitro);
				lblImagenArbitro.setBounds(0, 0, 637, 192);
				//lblImagenArbitro.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Imagenes/bannerArbitros.bmp")));
				lblImagenArbitro.setIcon(newIcon);
				//lblimagen = new JLabel();
				//getContentPane().add(lblimagen);
				//lblimagen.setBounds(0, 0, 264, 100);

			}
			{
				lblNombre = new JLabel();
				getContentPane().add(lblNombre);
				lblNombre.setText("Nombre");
				lblNombre.setBounds(75, 265, 62, 14);
			}
			{
				lblApellido = new JLabel();
				getContentPane().add(lblApellido);
				lblApellido.setText("Apellido");
				lblApellido.setBounds(299, 265, 56, 14);
			}
			{
				lblCedula = new JLabel();
				getContentPane().add(lblCedula);
				lblCedula.setText("Cedula");
				lblCedula.setBounds(75, 308, 56, 14);
			}
			{
				txtNombre = new JTextField();
				getContentPane().add(txtNombre);
				txtNombre.setBounds(155, 264, 102, 16);
			}
			{
				txtApellido = new JTextField();
				getContentPane().add(txtApellido);
				txtApellido.setBounds(367, 264, 102, 17);
			}
			{
				txtCedula = new JTextField();
				getContentPane().add(txtCedula);
				txtCedula.setBounds(155, 307, 102, 17);
			}
			{
				lvbDatos = new JLabel();
				getContentPane().add(lvbDatos);
				lvbDatos.setText("DATOS");
				lvbDatos.setBounds(292, 215, 119, 26);
				lvbDatos.setFont(new java.awt.Font("Arial",1,20));
			}
			{
				pnlBotones = new JPanel();
				getContentPane().add(pnlBotones);
				pnlBotones.setBounds(143, 409, 354, 42);
				{
					btnRegistrar = new JButton();
					pnlBotones.add(btnRegistrar);
					btnRegistrar.setText("Registrar");
				}
				{
					btnLimpiar = new JButton();
					pnlBotones.add(btnLimpiar);
					btnLimpiar.setText("Limpiar");
				}
				{
					btnSalir = new JButton();
					pnlBotones.add(btnSalir);
					btnSalir.setText("Salir");
					btnSalir.setBounds(97, 17, 35, 21);
				}
			}
			{
				lblfecha_nacimiento = new JLabel();
				getContentPane().add(lblfecha_nacimiento);
				lblfecha_nacimiento.setText("Fecha Nacimiento");
				lblfecha_nacimiento.setBounds(75, 352, 117, 14);
			}
			{
				pnlfecha = new JPanel();
				getContentPane().add(pnlfecha);
				pnlfecha.setBounds(204, 344, 259, 49);
				pnlfecha.setLayout(null);
				{ 
					
					SpinnerListModel cmbanoModel = 
							new SpinnerListModel(new String[] {"1941","1942","1943","1944","1945","1946","1947","1948","1949","1950",
									"1951","1952","1953","1954","1955","1956","1957","1958","1959","1960","1961",
									"1962","1963","1964","1965","1966","1967","1968","1969","1970","1971",
									"1972","1973","1974","1975","1976","1977","1978","1979","1980","1981","1982",
									"1983","1984","1985","1986","1987","1988","1989","1990","1991","1992","1993"});
					cmbano = new JSpinner();
					pnlfecha.add(cmbano);
					cmbano.setModel(cmbanoModel);
					cmbano.setBounds(178, 17, 60, 21);
				}
				{
					
						
					SpinnerListModel cmbmesModel = 
							new SpinnerListModel(new String[] {"1","2","3","4","5","6","7","8","9","10","11","12"});
					cmbmes = new JSpinner();
					pnlfecha.add(cmbmes);
					cmbmes.setModel(cmbmesModel);
					cmbmes.setBounds(103, 17, 48, 21);
					cmbmes.getEditor().setEnabled(false);
				}{
					SpinnerListModel cmbdiaModel = 
							new SpinnerListModel(new String[] {"1","2","3","4","5","6","7","8","9","10","11","12",
									"14","15","16","17","18","19","20","21","22",
									"23","24","25","26","27","28","29","30","31"});
					
					cmbdia = new JSpinner();
					pnlfecha.add(cmbdia);
					cmbdia.setModel(cmbdiaModel);
					cmbdia.setBounds(25, 17, 55, 21);
				}
				{
					lblano = new JLabel();
					pnlfecha.add(lblano);
					lblano.setText("Anno");
					lblano.setBounds(178, 3, 54, 14);
				}
				{
					lblmes = new JLabel();
					pnlfecha.add(lblmes);
					lblmes.setText("Mes");
					lblmes.setBounds(108, 4, 43, 14);
				}
				{
					lbldia = new JLabel();
					pnlfecha.add(lbldia);
					lbldia.setText("Dia");
					lbldia.setBounds(37, 4, 38, 14);
				}
			}
			this.setVisible(true);
			pack();
			this.setSize(633, 499);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}

}
